﻿<html>

  <head>
    <!--<meta http-equiv="Content-Type" content="text/html; charset=gb2312">-->
    <meta http-equiv="X-UA-Compatible" content="IE=10" />
    <title>SDK 演示</title>
    <link href="./css/test.css" rel="stylesheet">

    <script src="js/WsUtil.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/OcxUtil.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/axCam_Ocx.js" type="text/javascript" charset="utf-8" for="axCam_Ocx"
      event="MessageCallback(type,str)"></script>
    <script src="js/axCam_Ocx2.js" type="text/javascript" charset="utf-8" for="axCam_Ocx2"
      event="MessageCallback(type,str)"></script>
    <!--  <script type="text/javascript" for="axCam_Ocx" event="MessageCallback(type,str)"> -->
    <script>
      var isIE = true; //是否IE
      var isSecondDev = false; //是否有两个canvas显示视频
      var camidMain = 0; //主头ID
      var camidSub = 0; //副头ID

       
      //页面关闭时,停止摄像头,停止身份证读卡
      window.onbeforeunload = function(event) {
        
        StopICWork();
        CloseFinger();
        CloseCam();
        FaceCheckUninit();
        if (isSecondDev) {
          CloseCam2();
          FaceCheckUninitSecond();
        }
      } 
      //清除预览区域
      function clearPreviewArea(type){
        document.getElementById("img1").src=''
        document.getElementById("img1").baseURI=''
        document.getElementById('img1').hidden = true
        document.getElementById('Button7').value = '上传'
        if(type === 'upload'){
          InfoTextCallback(30,'')
        }else{
          document.getElementById("TextArea1").value=''
          InfoCallback(2)
        }
      }
      //加载控件
      function loadActiveX() {
        
        //if (navigator.userAgent.indexOf('MSIE') >= 0) {
        if (!!window.ActiveXObject || "ActiveXObject" in window) {
          isIE = true;
          //IE浏览器加载控件
          document.getElementById("ActiveXDivOne").innerHTML =
            "<OBJECT id=\"axCam_Ocx\"  classid=\"clsid:D5BD5B4A-4FC0-4869-880B-27EE9869D706\" width=\"100%;\" height=\"100%;\" ></OBJECT>";
          OcxInit();
        } else {
          isIE = false;
          if (!window.WebSocket) {
            alert("WebSocket not supported by this browser!");
          }
          //其他浏览器加载控件
          document.getElementById("ActiveXDivOne").innerHTML =
            " <canvas id=\"cameraCanvas\"  style=\"width:100%; height: 100%;\">";
          WsInit(0, 0, 0, 0, true);
        
        }
      }
     
      //必需重写---获取设备名称(num为当前摄像头数量,strUsbNamr为摄像头名字数组)
      function GetDevName(num, strUsbNamr) {
        var obj = document.getElementById("DeviceName");
        obj.options.length = 0;
        for (var i = 0; i < num; i++) {
          var objOption = document.createElement("option");
          objOption.text = strUsbNamr[i];
          objOption.value = i;
          obj.options.add(objOption);
        }
        obj.options[camidMain].selected = true;
        if (num > 0) {
          if (isSecondDev) {

            var obj2 = document.getElementById("DeviceName2");
            obj2.options.length = 0;
            if (num > 1) {


              for (var i = 0; i < num; i++) {
                var objOption = document.createElement("option");
                objOption.text = strUsbNamr[i];
                objOption.value = i;
                obj2.options.add(objOption);
              }
              obj2.options[camidSub].selected = true;
              OcxGetDeviceResolutionSecond();
              //}
            }
          }
        }

      }

      //必需重写---获取分辨率(data为分辨率数组,每2个为一组,宽高)
      function GetDeviceResolution(data) {
        
        var obj = document.getElementById("Resolution");
        // var max = 0;
        // var maxIndex = 0;
        
        obj.options.length = 0;
        if (data.length > 0) {
          var min = data[0];
          var minIndex = 0;
          for (var i = 0; i < data.length / 2; i++) {
            var objOption = document.createElement("option");
            var ww = data[i * 2];
            var hh = data[i * 2 + 1];
            objOption.text = "" + ww + "*" + hh;
            objOption.value = i;
            obj.options.add(objOption);         
            //选择最小分辨率
            // if(min>ww){
            // 		min=ww
            //     minIndex = i
            // 	}
          }
          // obj.options[maxIndex].selected = true;
          obj.options[1].selected = true;   //默认1920*1080

        }
      }

      //必需重写---获取分辨率副头(data为分辨率数组,每2个为一组,宽高)
      function GetDeviceResolutionSecond(data) {
        var obj = document.getElementById("Resolution2");
        var max = 0;
        var maxIndex = 0;
        obj.options.length = 0;
        for (var i = 0; i < data.length / 2 - 1; i++) {
          var objOption = document.createElement("option");
          var ww = data[i * 2];
          var hh = data[i * 2 + 1];
          objOption.text = "" + ww + "*" + hh;
          objOption.value = i;
          obj.options.add(objOption);
          if (max < ww) {
            max = ww;
            maxIndex = i;
          }
        }
        obj.options[maxIndex].selected = true;

      }

      //设备1初始化完成,可以进行相关操作
      function LoadOver() {
        StartVideo();
      }

      //设备2初始化完成,可以进行相关操作
      function LoadOver2() {
        StartVideo2();
      }



      //开启摄像头
      function StartVideo() {
        var obj = document.getElementById("Resolution");
        var restr = obj[obj.selectedIndex].text;
        var pos = restr.lastIndexOf("*");
        var width = parseInt(restr.substring(0, pos));
        var height = parseInt(restr.substring(pos + 1, restr.length));

        StartCam(camidMain, width, height);
        // StartCam(camidSub,1280,720);

      }

      //关闭摄像头
      function CloseVideo() {
        CloseCam();
      }

      //抓图拍照
      function Capture() {
        var type = 0;
        CaptureImage(type)
        document.getElementById('img1').hidden = false
      }

      //切换摄像头
      function ChangeDevice() {
        CloseCam();
        var devObj = document.getElementById("DeviceName");
        camidMain = devObj.selectedIndex;
        ChangeCamDevice(camidMain);
      }

      //切换分辨率
      function ChangeResolution() {
        CloseCam();
        var obj = document.getElementById("Resolution");
        var restr = obj[obj.selectedIndex].text;
        var pos = restr.lastIndexOf("*");
        var width = parseInt(restr.substring(0, pos));
        var height = parseInt(restr.substring(pos + 1, restr.length));
        StartCam(camidMain, width, height);

      }

      //设置图片类型
      function SetFileType() {
        var type = document.getElementById("FileType").selectedIndex;
        SetImageType(type);
      }

      //设置图片颜色格式
      function SetImageColorMode() {
        var type = document.getElementById("ColourMode").selectedIndex;
        SetColorMode(type);
      }

      //图像设置窗口
      function ShowImageSettingWindow() {
        ShowSettingWindow();
      }

      //设置是否裁剪
      function SetCutType() {
        var type = 0;

        if (document.getElementById("Radio1").checked) {
          type = 0;
        }
        if (document.getElementById("Radio2").checked) {
          type = 1;
        }
        if (document.getElementById("Radio3").checked) {
          type = 2;
        }
        SetCamCutType(type);
        SetCamCutType2(type);
      }

      //设置智能连拍模式
      function SetCaptureModel() {
        if (document.getElementById("Radio10").checked) {
          SetWiseCapture(0);
        }
        if (document.getElementById("Radio11").checked) {
          SetWiseCapture(1);
        }
        if (document.getElementById("Radio12").checked) {
          SetTimeCapture(1, 5000);
        }
      }

      //设置保存的文件路径
      function SetFilePath() {
        //var path = "C:\\Users\\Administrator\\Desktop"
        var path = "E:\\img"
        SetImagePath(path);
        SetImagePath2(path);

      }

      //设置拍照时是否只返回base64
      // function funSetImagebase64() {
      //    SetImagebase64(1);
      // }

      //启动身份证模块
      function funStartIC() {
        StartIC();
      }

      //启动身份证自动读卡
      function funStartICWork() {
        StartICWork();
      }

      //关闭身份证自动读卡
      function funStopICWork() {
        StopICWork();
      }

      function funGetOneIC() {
        GetOneIC();
      }

      function funGetICValues() {
        GetICValues();
      }

      //条码识别
      function funReadBarCode(type) {
        if (type == 0) {
          var imgPath = "D:\\barcode.jpg";
          ReadBarCode(imgPath);
        } else if (type == 1) {
          ReadBarQrcodeD(1);
        }
      }

      //二维码识别
      function funReadQrCode(type) {
        if (type == 0) {
          var imgPath = "D:\\qrcode.jpg";
          ReadQrCode(imgPath);
        } else if (type == 1) {
          ReadBarQrcodeD(2);
        }
      }

      //合并PDF
      function funConvertToPDF() {
        var pat1 = "D:\\add1.jpg";
        var pat2 = "D:\\add2.jpg";
        var pat3 = "D:\\add3.jpg";
        var pdfpath = "D:\\Convert.pdf";
        AddPDFImageFile(pat1);
        AddPDFImageFile(pat2);
        AddPDFImageFile(pat3);
        SavePDF(pdfpath);

      }

      //图片合并
      function funCombineTwoImage() {
        var dir = 1; // 1->垂直合并  2->水平合并
        if (document.getElementById("Radio4").checked) {
          dir = 1;
        }
        if (document.getElementById("Radio5").checked) {
          dir = 2;
        }

        var combinePath = "C:\\MyIMG\\CombineImg.jpg";
        var ImgPath1 = "C:\\MyIMG\\add1.jpg";
        var ImgPath2 = "C:\\MyIMG\\add2.jpg";
        CombineTwoImage(combinePath, ImgPath1, ImgPath2, dir);

      }

      //上传图片
      function funUpdataFile() {
        UpdataFile("127.0.0.1", 8080, "/FileStreamDemo/servlet/FileSteamUpload?", "D:\\add1.jpg");
      }

      //上传Base64(js自带功能)
      function funUpdataBase64() {
        var strImgBase64 = document.getElementById("img1").src
        if(strImgBase64 && strImgBase64.startsWith('data:image/jpg;base64,')){
          //调用
          const fileName ='GD'+ getRandomSixDigit()+'.jpg'
          var blob = dataURLtoBlob(strImgBase64)
          let file = blobToFile(blob,fileName);
          window.parent.getFromIframeImg(file)
          document.getElementById('Button7').value = '正在上传中...'
        }else{
          window.parent.getFromIframeImg('')
        }
        
      }
      //生成6位随机数
      function getRandomSixDigit(){
      let code = ''
      for(var i=0;i<10;i++){
      code += parseInt(Math.random()*10)
      }
       return code
      }
      //将base64转换为blob
     function dataURLtoBlob(dataurl) { 
          var arr = dataurl.split(','),
          mime = arr[0].match(/:(.*?);/)[1],
          bstr = atob(arr[1]),
          n = bstr.length,
          u8arr = new Uint8Array(n);
          while (n--) {
              u8arr[n] = bstr.charCodeAt(n);
          }
          return new Blob([u8arr], { type: mime });
      }
       
      //将blob转换为file
     function blobToFile(theBlob, fileName){
         theBlob.lastModifiedDate = new Date();
         theBlob.name = fileName;
         return theBlob;
      }
  

       /**
        * Base64字符串转File文件
        * @param {String} base64 Base64字符串(字符串不包含Data URI scheme)
        * @param {String} filename 文件名称
        * @param {String} type 文件类型(例如：image/png)
        */
       function base64toFile(base64, filename, type) {
       	// 将base64转为Unicode规则编码
       	let bstr = atob(base64);
       	let n = bstr.length;
       	let u8arr = new Uint8Array(n);
       	while (n--) {
       		u8arr[n] = bstr.charCodeAt(n); // 转换编码后才可以使用charCodeAt 找到Unicode编码
       	}
       	return new File([u8arr], filename, {
       		type: type
       	});
       }
      // function funUpdataBase64(){
      //   window.parent.getFromIframeImg("我叫iframe")
      // }
      //刷新设备
      function RefreshDev() {
        CloseCam();
        CloseCam2();
        RefreshDevice();
      }

      //根据文件路径获取base64
      function fungetBase64() {

        var strpath = "D:\\1.jpg";
        GetBase64FromFile(strpath);
      }

      //设置水印
      function SetWaterType() {
        if (document.getElementById("Radio6").checked) {
          CloseWaterMark();
        }
        if (document.getElementById("Radio7").checked) {
          var waterinfo = "我的水印";
          var FontSize = 50;
          var FontSytle = 0;
          var xOff = 100;
          var yOff = 100;
          OpenWaterMark(waterinfo, FontSize, FontSytle, 255, 0, 0, xOff, xOff);
        }
      }

      //设置自动裁边单图与多图
      function funsetJiubianModel() {
        if (document.getElementById("Radio13").checked) {
          SetJiubianModel(0);
          // axCam_Ocx.CusCrop(0);
        } else if (document.getElementById("Radio14").checked) {
          SetJiubianModel(1);
        }
      }

      //设置四周补白
      function funsetBuBai() {
        var isCheck = document.getElementById("checkbox2").checked;
        if (isCheck) {
          SetBuBai(1);
        } else SetBuBai(0);
      }

      //设置去灰
      function funsetQudise() {
        var isCheck = document.getElementById("checkbox1").checked;
        if (isCheck) {
          SetQudise(1);
        } else SetQudise(0);
      }

      function funSetFileNameModel() {
        if (document.getElementById("Radio19").checked) {
          //自定义
          var num = 1;
          var name = "IMGAAA";
          SetFileNameCustom(name, num);

          var num2 = 10;
          var name2 = "IMGAAAsub";
          SetFileNameCustom2(name2, num2);
        } else if (document.getElementById("Radio20").checked) {
          //时间
          SetFileNameTime();
          SetFileNameTime2();
        } else if (document.getElementById("Radio21").checked) {
          //固定
          var name = "固定";
          SetFileNameFixed(name);

          var name2 = "固定ssss";
          SetFileNameFixed2(name2);
        }
      }

      function funSetAutoExposure() {
        if (document.getElementById("RadioExopen").checked) {
          SetAutoExposure(1);
        } else if (document.getElementById("RadioExclose").checked) {
          SetAutoExposure(0);
        }
      }

      function funGetCamParameter() {
        GetCamParameter();
      }

      function funSetExposure() {
        SetExposure(0);
      }

      function funSetBrightness() {
        SetBrightness(0);
      }

      function funGetCamNum() {
        GetCamNum();
      }

      function funDeleteFile() {
        var filename = "D:\\1.jpg";
        DeleteFile(filename);
      }

      function funSetJpgQuanlity() {

        SetJpgQuanlity(100);
      }

      function funGetICPictureAll() {

        GetICPictureAll();
      }

      function funSetCusCropPlace() {

        var cutX = 800;
        var cutY = 600;
        var cutW = 800;
        var cutH = 600;


        SetCusCropPlace(cutX, cutY, cutW, cutH);


      }

      function funSetCusCropPlace2() {

        var cutX = 100;
        var cutY = 100;
        var cutW = 400;
        var cutH = 300;

        SetCusCropPlace2(cutX, cutY, cutW, cutH);


      }

      function funBeginVideo() {
        var filename = "D:\\videoOne.avi";
        BeginVideo(filename, 0, 1);
      }

      function funStopVideo() {
        StopVideo();
      }

      function funBeginVideo2() {
        var filename = "D:\\videoTwo.avi";
        BeginVideoSecond(filename, 0, 1);
      }

      function funStopVideo2() {
        StopVideoSecond();
      }

      function funGetAudioName() {
        GetAudioName();
      }

      function funMakeDir() {
        var filename = "D:\\ceshi";
        MakeDir(filename);
      }

      function funAutoFoucs() {
        AutoFoucs();
      }


      var hide_show = 0;

      function ShowHide() {

        if (hide_show == 0) {
          hide_show = 1;
          if (isIE) {
            document.getElementById("axCam_Ocx").style.visibility = "hidden";
          } else document.getElementById("cameraCanvas").style.visibility = "hidden";
        } else {
          hide_show = 0;
          if (isIE) {
            document.getElementById("axCam_Ocx").style.visibility = "visible";
          } else document.getElementById("cameraCanvas").style.visibility = "visible";
        }

      }

      function funShowImg() {
        if (isIE) {
          document.getElementById("axCam_Ocx").style.visibility = "hidden";
        }
        var modal = document.getElementById('myModal');
        var img = document.getElementById('img1');
        var modalImg = document.getElementById("img01");
        var captionText = document.getElementById("caption");
        modal.style.display = "block";
        modalImg.src = img.src;
        captionText.innerHTML = img.alt;
      }

      function funShowImg2() {
        if (isIE) {
          document.getElementById("axCam_Ocx").style.visibility = "hidden";
        }
        var modal = document.getElementById('myModal');
        var img = document.getElementById('img2');
        var modalImg = document.getElementById("img01");
        var captionText = document.getElementById("caption");
        modal.style.display = "block";
        modalImg.src = img.src;
        captionText.innerHTML = img.alt;
      }


      function funCloseShowImg() {
        document.getElementById('myModal').style.display = 'none'

        if (isIE) {
          document.getElementById("axCam_Ocx").style.visibility = "visible";
        }
      }

      function ShowInfo(op) {
        var obj = document.getElementById("TextArea1");
        obj.value = op + obj.value;
      }
      /*****************************副摄像头操作部分*******************************************

      *****************************************************************************************/


      //打开副摄像头
      function StartVideo2() {
        if (camidSub >= 0) {
          var obj = document.getElementById("Resolution2");
          var restr = obj[obj.selectedIndex].text;
          var pos = restr.lastIndexOf("*");
          var width = parseInt(restr.substring(0, pos));
          var height = parseInt(restr.substring(pos + 1, restr.length));
          StartCam2(camidSub, width, height);
        }

      }

      //关闭副摄像头
      function CloseVideo2() {
        CloseCam2();
      }

      //切换摄像头
      function ChangeDevice2() {
        CloseCam2();
        var devObj = document.getElementById("DeviceName2");
        camidSub = devObj.selectedIndex;
        ChangeCamDevice2(camidSub);
      }

      //切换分辨率
      function ChangeResolution2() {
        CloseCam2();
        var obj = document.getElementById("Resolution2");
        var restr = obj[obj.selectedIndex].text;
        var pos = restr.lastIndexOf("*");
        var width = parseInt(restr.substring(0, pos));
        var height = parseInt(restr.substring(pos + 1, restr.length));
        StartCam2(camidSub, width, height);

      }


      //副头拍照
      function Capture2() {
        var type = 0;
        if (document.getElementById("Radio1").checked) {
          //不裁边
          type = 0;
        } else if (document.getElementById("Radio2").checked) {
          //自动裁边
          type = 1;
        } else if (document.getElementById("Radio3").checked) {
          //手动裁边
          type = 2;
        }
        CaptureImage2(type);

      }

      function InfoCallback(op) {
        
        var text = "";
        if (op == 0) {
          text = "连接成功\r\n";
        } else if (op == 0x01) {
          text = "断开成功\r\n";
        } else if (op == 0x02) {
          text = "设备已经连接\r\n";
        } else if (op == 0x03) {
          text = "设备已经关闭\r\n";
          //重新打开摄像头
          StartVideo()
        } else if (op == 0x04) {
          text = "拍照成功\r\n";
        } else if (op == 0x05) {
          text = "pdf添加文件成功\r\n";
        } else if (op == 0x06) {
          text = "pdf保存成功\r\n";
        } else if (op == 0x07) {
          text = "图片合并成功\r\n";
        } else if (op == 0x08) {
          text = "智能连拍启动\r\n";
        } else if (op == 0x09) {
          text = "定时连拍启动\r\n";
        } else if (op == 0x10) {
          text = "定时连拍成功\r\n";
        } else if (op == 0x11) {
          text = "定时连拍关闭\r\n";
        } else if (op == 0x12) {
          text = "文件上传服务器成功\r\n";
        } else if (op == 0x13) {
          text = "水印开启\r\n";
        } else if (op == 0x14) {
          text = "水印关闭\r\n";
        } else if (op == 0x15) {
          text = "此设备属于本公司\r\n";
        } else if (op == 0x16) {
          text = "此设备不属于本公司\r\n";
        } else if (op == 0x17) {
          text = "自动曝光启动\r\n";
        } else if (op == 0x18) {
          text = "自动曝光关闭\r\n";
        } else if (op == 0x19) {
          text = "身份证功能启动成功\r\n";
        } else if (op == 0x1a) {
          text = "身份证功能启动失败\r\n";
        } else if (op == 0x1b) {
          text = "身份证读卡成功\r\n";
        } else if (op == 0x1c) {
          text = "身份证读卡失败\r\n";
        } else if (op == 0x1d) {
          text = "重新操作\r\n";
        } else if (op == 0x1e) {
          text = "未发现模块\r\n";
        } else if (op == 0x1f) {
          text = "未启动身份证功能\r\n";
        } else if (op == 0x20) {
          text = "启动身份证自动读卡\r\n";
        } else if (op == 0x21) {
          text = "关闭身份证自动读卡\r\n";
        } else if (op == 0x22) {
          text = "启动拍照只生成base64\r\n";
        } else if (op == 0x23) {
          text = "关闭拍照只生成base64\r\n";
        } else if (op == 0x25) {
          text = "初始化指纹模块成功\r\n";
        } else if (op == 0x26) {
          text = "初始化指纹模块失败\r\n";
        } else if (op == 0x27) {
          text = "未初始化指纹模块\r\n";
        } else if (op == 0x28) {
          text = "身份证没有指纹数据\r\n";
        } else if (op == 0x29) {
          text = "指纹认证成功\r\n";
        } else if (op == 0x30) {
          text = "开始指纹认证\r\n";
        } else if (op == 0x31) {
          text = "正在指纹认证\r\n";
        } else if (op == 0x32) {
          text = "停止指纹认证\r\n";
        } else if (op == 0x33) {
          text = "指纹认证失败\r\n";
        } else if (op == 0x34) {
          text = "开始录像\r\n";
        } else if (op == 0x35) {
          text = "停止录像\r\n";
        } else if (op == 0x36) {
          text = "正在录像中\r\n";
        } else if (op == 0x37) {
          text = "开始录像副头\r\n";
        } else if (op == 0x38) {
          text = "停止录像副头\r\n";
        } else if (op == 0x39) {
          text = "正在录像中副头\r\n";
        } else if (op == 0x44) {
          text = "建立文件成功\r\n";
        } else if (op == 0x45) {
          text = "建立文件失败\r\n";
        } else if (op == 0x46) {
          text = "人脸识别初始化成功\r\n";
        } else if (op == 0x47) {
          text = "启动人脸对比\r\n";
        } else if (op == 0x48) {
          text = "人脸识别初始化成功\r\n";
        } else if (op == 0x49) {
          text = "主头正在连接中\r\n";
        } else if (op == 0x4a) {
          text = "主头等待连接\r\n";
        } else if (op == 0x4b) {
          text = "副头正在连接中\r\n";
        } else if (op == 0x4c) {
          text = "副头等待连接\r\n";
        } else if (op == 0xa0) {
          text = "没有对应分辨率\r\n";
        } else if (op == 0xa1) {
          text = "pdf没有添加任何文件\r\n";
        } else if (op == 0xa2) {
          text = "文件不存在\r\n";
        } else if (op == 0xa3) {
          text = "意外断开\r\n";
        } else if (op == 0xa4) {
          text = "连接不上\r\n";
        } else if (op == 0xa5) {
          text = "pdf添加文件不是jpg格式\r\n";
        } else if (op == 0xa6) {
          text = "没有发现摄像头\r\n";
        } else if (op == 0xa7) {
          text = "camid无效\r\n";
        } else if (op == 0xa8) {
          text = "图片尺寸太小\r\n";
        } else if (op == 0xa9) {
          text = "文件上传服务器失败\r\n";
        } else if (op == 0xaa) {
          text = "该设备没有副头\r\n";
        } else if (op == 0xab) {
          text = "条码识别失败\r\n";
        } else if (op == 0xac) {
          text = "二维码识别失败\r\n";
        } else if (op == 0xad) {
          text = "图片合并失败\r\n";
        } else if (op == 0xae) {
          text = "设置路径失败,路径不存在\r\n";
        } else if (op == 0xaf) {
          text = "摄像头切换太频繁\r\n";
        } else if (op == 0xb1) {
          text = "未发现指纹模块\r\n";
        } else if (op == 0xb2) {
          text = "录像分辨率不能高于1600*1200\r\n";
        } else if (op == 0xb3) {
          text = "副头录像分辨率不能高于1600*1200\r\n";
        } else if (op == 0xb4) {
          text = "没发现麦克风\r\n";
        } else if (op == 0xb8) {
          text = "人脸识别初始化失败\r\n";
        } else if (op == 0xb9) {
          text = "请读取身份证信息\r\n";
        } else if (op == 0xba) {
          text = "请先初始化人脸识别\r\n";
        } else if (op == 0xbb) {
          text = "没有发现合适的人脸\r\n";
        }

        var obj = document.getElementById("TextArea1");
        obj.value = text + obj.value;
      }

      function InfoTextCallback(type, str) {
        var text = "";
        if (type == 0) {
          text = "图片路径:" + str + "\r\n";
        } else if (type == 1) {
          text = "默认路径:    " + str + "\r\n";

        } else if (type == 2) {
          text = "条码:    " + str + "\r\n";
          window.parent.getBarCode(str)
        } else if (type == 3) {
          text = "文件上传服务器成功:" + str + "\r\n";

        } else if (type == 4) {
          text = "文件上传服务器失败:" + str + "\r\n";

        } else if (type == 5) {
          // text = "base64编码成功,请自行处理str\r\n";
          text = "已拍照,请上传图片\r\n";
          var imgobj1 = document.getElementById("img1");
           imgobj1.src = "data:image/jpg;base64," + str;
        } else if (type == 6) {
          text = "删除文件成功:" + str + "\r\n";
        } else if (type == 7) {
          text = "二维码:" + str + "\r\n";
        } else if (type == 8) {
          text = "拍照失败:" + str + "\r\n";
        } else if (type == 9) {
          text = "身份证名字:" + str + "\r\n";
        } else if (type == 10) {
          text = "身份证号码:" + str + "\r\n";
        } else if (type == 11) {
          text = "身份证性别:" + str + "\r\n";
        } else if (type == 12) {
          text = "身份证民族:" + str + "\r\n";
        } else if (type == 13) {
          text = "身份证生日:" + str + "\r\n";
        } else if (type == 14) {
          text = "身份证地址:" + str + "\r\n";
        } else if (type == 15) {
          text = "身份证签发机关:" + str + "\r\n";
        } else if (type == 16) {
          text = "身份证有效开始日期:" + str + "\r\n";
        } else if (type == 17) {
          text = "身份证有效截至日期:" + str + "\r\n";
        } else if (type == 18) {
          text = "安全模块号:" + str + "\r\n";
        } else if (type == 19) {
          //身份证头像
          text = "身份证头像base64\r\n";
          var imgobj1 = document.getElementById("img1");
          imgobj1.src = "data:;base64," + str;
        } else if (type == 21) {
          text = "base64编码成功,请自行处理str(副头)\r\n";
          //text ="data:;base64," +str+"\r\n";
          var imgobj1 = document.getElementById("img2");
          imgobj1.src = "data:;base64," + str;
        } else if (type == 22) {
          text = "曝光范围:" + str + "\r\n";
        } else if (type == 23) {
          text = "亮度范围:" + str + "\r\n";
        } else if (type == 24) {
          text = "上传服务器返回:" + str + "\r\n";
        } else if (type == 25) {
          var imgobj1 = document.getElementById("img1");
          imgobj1.src = "data:;base64," + str;
          text = "身份证复印件" + "\r\n";
        } else if (type == 26) {
          text = "当前设备数量:" + str + "\r\n";
        } else if (type == 27) {
          text = "麦克风:" + str + "\r\n";
        } else if (type == 28) {
          text = "人脸抓拍base64编码成功,请自行处理str\r\n";
          // text ="data:;base64," +str+"\r\n";
          var imgobj1 = document.getElementById("img1");
          imgobj1.src = "data:;base64," + str;
        }else if(type == 30){
          text = "图片上传成功" + str + "\r\n";
        }
        var obj = document.getElementById("TextArea1");
        obj.value = text + obj.value;
      }
    </script>

  </head>

  <body onload="loadActiveX();">
    <div style="width:721px;height: 552px; border:1px solid #c3c3c3;">
    <div style="width:500px; height: 552px;float:left;border-right: 1px solid #c3c3c3;">
      <div style="width:100%; height: 70%; margin-top: 0%; margin-left: 0%;" id='ActiveXDivOne'>
      </div>
      <p style=" width:100%; height:30px">
      <table style="width:100%;">
        <tr>
          <td class="style5" style="font-size: medium">
            设备：</td>
          <td class="style1">
            <select id="DeviceName" name="D1" onchange="ChangeDevice()" disabled>
            </select>
          </td>
        </tr>
        <tr>
          <td class="style5" style="font-size: medium">
            分辨率：</td>
          <td class="style3">
            <select id="Resolution" name="D2" onchange="ChangeResolution()">
            </select>
          </td>
        </tr>
      </table>
      <table class="optionBtn" style="margin-top: 25px; display: flex; align-items: center;justify-content: center">
        <tr>
         <!-- <td style="font-size: 14px;">
            <input id="checkboxBase" type="checkbox"  value="拍照base64" onclick = "funSetImagebase64();" >拍照base64</td> 
          </td> -->
          <!-- <td>
            <input id="Button8" type="button" value="条码识别" onclick="funReadBarCode(1);" />
          </td> -->
          <td>
            <input id="Button2" type="button" value="拍照" onclick="Capture();"  style="margin: 0 35px"/>
          </td>  
          <td>
            <input id="Button7" type="button" value="上传图片" onclick="funUpdataBase64();"/>
          </td>       
        </tr>
      </table>
      </p>
    </div>
    <div style="width:218px; height: 552px;float:left">
      <div style="width: 100%;height: 29%; border-bottom: 1px solid #c3c3c3; display: flex; align-items: center;">
        <img id="img1" style="max-width: 100%; height: auto;" onclick="funShowImg()" />
      </div>
      <!-- <div style="width: 100%;height: 30%;">
        <img id="img2" style="width: 99%;height: 100%" onclick="funShowImg2()" />
      </div> -->
      <div style="width: 100%;height: 70%;">
        <textarea id="TextArea1" cols="20" rows="2" style="width: 100%;height:100%; border: none;" disabled>
							</textarea>
      </div>
    </div>
    </div>  
    <div id="myModal" class="modal">

      <!-- 关闭按钮 -->
      <span class="close" onclick="funCloseShowImg()">&times;</span>

      <!-- 弹窗内容 -->
      <img class="modal-content" id="img01">

      <!-- 文本描述 -->
      <div id="caption"></div>
    </div>
 
  </body>

</html>